<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>Document</title>
	<link rel="stylesheet" href="http://127.0.0.1/huaweishop/Static/Admin/Bootstrap/Css/bootstrap.min.css" />
	<link rel="stylesheet" href="http://127.0.0.1/huaweishop/Static/Admin/Css/common.css" />
	<script type="text/javascript" src='http://127.0.0.1/huaweishop/Static/Admin/Js/jquery-1.7.2.min.js'></script>
	<style type="text/css">
		body{
			margin-bottom: 100px;
		}
	</style>
</head>
<body>
	<div class="container-fluid">
	<div class="row-fluid">
	<div class="span12">

	
	<form action="<?php echo U('GoodsList/add');?>" method='post'>
	
		<table class='table table-bordered table-hover'>
			<tr>
				<th>货品ID</th>

				<?php foreach ($data as $k=>$v){?>
					<th     <?php if(!$v['gtvalue'][0]['gtvalue']){ ?>style="display:none"<?php } ?>><?php echo $v['taname'];?></th>
				<?php }?>

				<th>库存</th>
				<th>货号</th>
				<th>操作</th>
			</tr>

			<?php foreach ($list as $kk=>$vv){?>
				<tr class="info">
					<td><?php echo $vv['glid'];?></td>
				    
				    	<?php foreach ($vv['combin_name'] as $key=>$value){?>
					    	
							  <td     <?php if(!$value){ ?>style="display:none"<?php } ?> ><?php echo $value;?></td>
						   
						<?php }?>
					
					<td><?php echo $vv['inventory'];?></td>
					<td><?php echo $vv['number'];?></td>
					<td>
						<a href="<?php echo U('GoodsList/edit',array('glid'=>$vv['glid'],'gid'=>$_GET['gid'],'tid'=>$_GET['tid']));?>" class="btn btn-warning"><i class="icon-pencil icon-white"></i>修改</a>
						<a href="javascript:;" onclick="if(confirm('确定删除吗')) location.href='<?php echo U('GoodsList/del',array('glid'=>$vv['glid']));?>'" class="btn btn-danger"><i class="icon-trash icon-white"></i>删除</a>
					</td>
				</tr>
			<?php }?>

			<!-- 如果已添加数目小于可能情况数目，才出现添加货品的输入框 -->
		
			<tr class="info">
				<td>添加货品</td>
		
			      <?php foreach ($data as $k=>$v){?>
					<td     <?php if(!$v['gtvalue'][0]['gtvalue']){ ?>style="display:none"<?php } ?>>
						    <?php if($v['gtvalue'][0]['gtvalue']){ ?>
						<select name="combin[]">
							<option value="0">-请选择-</option>
							 <?php foreach ($v['gtvalue'] as $key=>$vv){?>
								<option  value="<?php echo $vv['gtid'];?>"><?php echo $vv['gtvalue'];?></option>
							<?php }?>
						</select>
						<?php } ?>
					</td>
				<?php }?>


				<td>
					<input type="text"  name='inventory'/>
				</td>
				<td>
					<!--<input type="text" name='number' value="" />-->
				</td>
				<td></td>
			</tr>
		
		</table>

	
		<input type="hidden" name='goods_gid' value='<?php echo $hd['get']['gid'];?>'/>
		<input type="hidden" name='tid' value='<?php echo $hd['get']['tid'];?>'/>
		<input type="submit" value='保存添加' class="btn btn-primary"/>
	</form>
	

	</div>
	</div>
	</div>



</body>
</html>